Skip to content

fix(claude-code): skip primary + duplicate banks in recallAdditionalBanks - #2625

Merged
benfrank241 merged 1 commit into
mainfrom
fix/claude-code-recall-primary-dedup
Jul 9, 2026
Merged

fix(claude-code): skip primary + duplicate banks in recallAdditionalBanks#2625
benfrank241 merged 1 commit into
mainfrom
fix/claude-code-recall-primary-dedup

Conversation

@benfrank241

Copy link
Copy Markdown
Member

Fixes #2604.

Problem

The claude-code recall hook's recallAdditionalBanks loop recalled every entry with no dedup against the session's resolved primary bank. So a bidirectional cross-bank setup (each bank lists the other, so both must appear in recallAdditionalBanks) re-recalled the primary on every prompt — one wasted recall call (~0.4–0.65s) per user prompt, plus duplicate context.

Fix

Guard the additional-banks loop with a seen_banks set seeded with the primary bank_id (already recalled above). This skips the primary and also de-dups repeated entries in the list.

seen_banks = {bank_id}
for extra_bank_id in additional_banks:
    if extra_bank_id in seen_banks:
        continue
    seen_banks.add(extra_bank_id)
    ...

Test

Adds test_additional_banks_skip_primary_and_duplicates — primary listed in recallAdditionalBanks plus a duplicated extra → asserts the primary is recalled once, the extra once, 2 calls total (not 4). Full test_hooks.py green (30 passed).

Thanks @hb-cam for the precise repro and the one-liner.

…anks

The additional-banks recall loop recalled every entry with no dedup against
the resolved primary, so bidirectional cross-bank setups (primary listed in
recallAdditionalBanks) re-recalled the primary on every prompt — a wasted
recall call plus duplicate context. Guard the loop with a seen-set seeded with
the primary bank; also dedups repeated entries. Fixes #2604.
@benfrank241
benfrank241 merged commit b0fb111 into main Jul 9, 2026
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude-code plugin: recallAdditionalBanks re-recalls the primary bank when it appears in the list

1 participant